//this is a change s
import java.util.Random;


public class Cat {

	private String name;
	private String color;
	private int age;
	private int lives;
	public int expr;

	public Cat(Cat other) {
	this.name=other.name;
	this.color=other.color;
	this.age=other.age;
	this.lives=other.lives;
	this.expr=other.expr;
	}
public boolean equals(Cat other){
	if (this==other){
		return true ;
	}
	
return(this.name.equals(other.name)&& 
		this.color.equals(other.color) && 
		this.age==other.age&&
		this.lives==other.lives&& this.expr==other.expr);
}

	
	
	public Cat(String nameIn,String colorIn,int ageIn) {
		name=nameIn;
		color=colorIn;
		age= ageIn;
		lives= 9;
		expr= 0;
	}
	public Cat(String nameIn,String colorIn) {
		name=nameIn;
		color=colorIn;
		age= 5;
		lives= 9;
		expr= 0;
	}

	public void fight( Cat other){
		System.out.println(name +" "+(this.figtCode()+expr)+  " is fighting " +other.getName()+" "+(other.figtCode()+other.expr));
		
			if (this.figtCode()+expr >= other.figtCode()+other.expr){
				other.die();
				this.expr++;

			}else {
				this.die();
				other.expr++;
			}
	
	}

	public int figtCode (){
		int fightCode=0;
		Random a = new Random();

		if (age <5){
			fightCode+=5;
		}else if(age>=5 & age <15){
			fightCode+=8;
		}else if (age >=15 ){
			fightCode+=5;
		}

		return fightCode+= a.nextInt(5);

	}



	public String getName(){
		return name;
	}

	public int getExper(){
		return expr;
	}
	public void setName(String nameIn){
		name= nameIn;
	}

	public void die (){
		if (lives>=1){
			System.out.println("you killed " +name);
			lives--;
		}
	}

	public boolean isAvile(){
		if (lives >0){
			return true;
		}else{
			return false;
		}
	}



	public String toString(){
		return  "Hi meow my name name is "+ name+ " I am a "+ color+" " +age +" year old Cat. I have "  + lives + " lives.";
	}

	/**
	 * @return the color
	 */
	public String getColor() {
		return color;
	}

	/**
	 * @return the age
	 */
	public int getAge() {
		return age;
	}

	/**
	 * @return the lives
	 */
	public int getLives() {
		return lives;
	}

}
